from fastapi import APIRouter, Depends
from app.api.deps import (
    get_current_user,
    CurrentUser
)
from app.schemas.uc.user import (
    UserPublic
)

# 将登录态验证依赖移至路由初始化，所有接口自动继承
router = APIRouter(
    tags=["users"], 
    prefix="/users",
    dependencies=[Depends(get_current_user)]  # 路由级统一登录验证
)

# 获取当前用户个人信息
@router.get("/me", response_model=UserPublic)
async def read_user(
    current_user: CurrentUser
):
    """
    Get current user.
    """
    return current_user